package org.dromara.exam.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.exam.domain.bo.ExamRepoBo;
import org.dromara.exam.domain.bo.ExamTagBo;
import org.dromara.exam.domain.vo.ExamRepoVo;
import org.dromara.exam.domain.vo.ExamTagVo;
import org.dromara.exam.service.IExamTagService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 标签信息
 *
 * @author xiyin321
 * @since 2025/2/6
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/exam/tag/")
public class ExamTagController {
    private final IExamTagService tagService;

    /**
     * 分页查询标签信息
     * @param bo
     * @param pageQuery
     * @return
     */
    @SaCheckPermission(value = {"exam:tag:list", "exam:tag:query"}, mode = SaMode.OR)
    @GetMapping("page")
    public TableDataInfo<ExamTagVo> list(ExamTagBo bo, PageQuery pageQuery) {
        return tagService.queryPageList(bo, pageQuery);
    }

    /**
     * 查询标签列表
     * @param bo
     * @return
     */
    @SaCheckPermission(value = {"exam:tag:list", "exam:tag:query"}, mode = SaMode.OR)
    @GetMapping("list")
    public R<List<ExamTagVo>> all(ExamTagBo bo) {
        return R.ok(tagService.queryList(bo));
    }
}
